#include "error_handler.h"
#include "maindefs.h"
#include <string.h>
#include <delays.h>

// This function prints out the line and function in which
// the error occurred, as well as the error code

void handle_error(signed char err_code, int line, char file_name[])
{
	static int error_count = 0;
	int fname_size = strlen(file_name);
	int count = 0;
	// Disable interrupts
	RCONbits.IPEN = 0;
	INTCONbits.GIEH = 0;
	INTCONbits.GIEL = 0;
#if !SENSORS_PIC
	while(1) {
		ERRLED = ~ERRLED;
		Delay10KTCYx(100);
	}
#endif
	// Set breakpoint here if SENSORS_PIC
	error_count++;
}
